package com.huawei;

/**
 * Created by Z-hong on 2024/7/22.
 */
import java.util.*;
public class HJ55 {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int count=sc.nextInt();
        int res=0;
        for(int i=1;i<=count;i++){

            if(i%7==0){res++;continue;}
            String str=String.valueOf(i);
            if(str.contains("7")){res++;}
        }
        System.out.println(res);
    }
}
